package cn.stronglink.asset.module.dam.utils.dataJsonUtils.realtime.receive;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.poi.ss.formula.functions.T;

import cn.stronglink.asset.model.CabinetExt;
import cn.stronglink.asset.model.DeviceType;
import cn.stronglink.asset.model.SensorSetting;

public class ListContainerUtil {
	
	// list容器: 数据库的更新--数据容器
	private List<SensorSetting> senUplist = null;
	private List<SensorSetting> senInlist = null;
	private List<CabinetExt> cabUplist = null;
	private List<CabinetExt> cabInlist = null;
	private List<DeviceType> devtypeUplist = null;
	private List<DeviceType> devtypeInlist = null;

	// 数组--所有位置的 传感器(门， 温湿度)
	private Object[] sensorPositions = null;

	// 构造方法： 初始化赋值
	public ListContainerUtil(int sensorCount) {
		sensorPositions = new Object[sensorCount];
		for (int i = 0; i < sensorCount; i++) {
			sensorPositions[i] = new ArrayList<SensorSetting>();
		}
	}

	public ListContainerUtil() {
		senUplist = new ArrayList<SensorSetting>();
		senInlist = new ArrayList<SensorSetting>();
		cabUplist = new ArrayList<CabinetExt>();
		cabInlist = new ArrayList<CabinetExt>();
		devtypeUplist = new ArrayList<DeviceType>();
		devtypeInlist = new ArrayList<DeviceType>();
	}

	// 每次使用前都清空容器,使得复用
	public void clearAllSensor() {
		if(senUplist!=null )senUplist.clear();
		if(senInlist!=null )senInlist.clear();
		
		if(sensorPositions==null)return;
		
		int sensorCount = sensorPositions.length;
		for (int i = 0; i < sensorCount; i++) {
			ArrayList<SensorSetting> list = (ArrayList<SensorSetting>) sensorPositions[i];
			list.clear();
		}
	}

	public void clearAllDoorSensor() {
		cabUplist.clear();
		cabInlist.clear();
		devtypeUplist.clear();
		devtypeInlist.clear();
	}
	
	public List<SensorSetting> getSenUplist() {
		return senUplist;
	}
	public List<SensorSetting> getSenInlist() {
		return senInlist;
	}

	public List<CabinetExt> getCabUplist() {
		return cabUplist;
	}
	public List<CabinetExt> getCabInlist() {
		return cabInlist;
	}
	public Object[] getSensorPositions() {
		return sensorPositions;
	}
	public List<DeviceType> getDevtypeUplist() {
		return devtypeUplist;
	}
	public List<DeviceType> getDevtypeInlist() {
		return devtypeInlist;
	}
	
}
